<template>
  <div>
    <el-dropdown>
      <el-dropdown-menu></el-dropdown-menu>
      <i class="iconfont" style="margin-right:15px">&#xe616;</i>
      <span @mouseenter="loginout">
        欢迎 admin
      </span>
       <i class="el-icon-caret-bottom"></i>
    </el-dropdown>
    <button v-show="show" class="but" @mouseleave="out" @click="add()">退出登录</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      show: false,
      // token:JSON.parse(localStorage.getItem('admin'))
    }
  },
  methods: {
    loginout() {
      this.show = true;
    },
    out(){
    this.show = false;
    },
    add(){
        // this.token=false
        // if(this.token==false){
        //     this.$router.push("/login")
        // }
      this.$router.push("/login")
    }
  }
};
</script>

<style scoped>
.but {
  width: 13%;
  height: 8%;
  border: 1px;
  position: absolute;
  top: 7%;
  right: 0.5%;
  background: white;
  text-align: center;
  outline: none;
}
</style>